Basic Types and Constants
You use the following 16 bit value to distinguish among ports.
typedef UInt16 InetPort;You can use the protocol nameskTCPName
,kUDPName
, andkRawIPName
when calling theOTCreateConfiguration
function to configure an endpoint. You can use the protocol namekDNRName
when calling theOTCreateConfiguration
function to configure a mapper. TheOTCreateConfiguration
function is described in the chapter "Initializing and Closing Open Transport Reference" in this book.
#define kTCPName "tcp" #define kUDPName "udp" #define kRawIPName "rawip" #define kDNRName "dnr"You can use the constantkDefaultInternetServicesPath
to create a TCP/IP service provider. Its value is a pointer to a configuration structure, so you do not use theOTCreateConfiguration
function with this constant. Instead you use this constant as a parameter when calling theOTAsyncOpenInternetServices
and theOTOpenInternetServices
functions that create TCP/IP service providers.
#define kDefaultInternetServicesPath ((OTConfiguration*)-3)You use theAF_INET
andAF_DNS
values as address types when filling in address structures. For details, see "Internet Address Structure" and "DNS Address Structure".
enum { AF_INET = 2, AF_DNS = 42 };You can use thekOTAnyInetAddress
value with theOTBind
function when you are not concerned with the specific IP interface you are binding to.
enum { kOTAnyInetAddress = 0 }; enum { kMaxHostAddrs = 10, kMaxSysStringLen = 32, kMaxHostNameLen = 255 }; typedef char InetDomainName[kMaxHostNameLen];The following completion event codes are sent by TCP/IP service
kMaxHostAddrs
- The maximum number of hosts returned by the function
OTInetStringToAddress
.kMaxSysStringLen
- The maximum length of the strings returned by the function OTInetSysInfo.
kMaxHostNameLen
- The maximum length of an Internet domain name.
- Note
- The maximum valid domain-name length for fully qualified domain names includes the trailing period (.). Names not terminated with a period are limited to
254 bytes.![]()
provider functions:
enum { T_DNRSTRINGTOADDRCOMPLETE = 0x10000001, T_DNRADDRTONAMECOMPLETE = 0x10000002, T_DNRSYSINFOCOMPLETE = 0x10000003, T_DNRMAILEXCHANGECOMPLETE = 0x10000004, T_DNRQUERYCOMPLETE = 0x10000005 }; enum { kDefaultInetInterface = -1, kInetInterfaceInfoVersion = 2 };The
kDefaultInetInterface
Value passed toOTInetGetInterfaceInfo
to get the interface configured in the TCP/IP control panel.kInetInterfaceInfoVersion
Version number of the correctInetInterfaceInfo
structure.SET_TOS
macro is used when negotiating IP_TOS option.
#define SET_TOS(prec,tos)(((0x7 & (prec)) << 5) | (0x1c & (tos)))